using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UI_Loading : WindowRoot
{
    private Image mImgProcess;
    private Text mTextProcess;

    private void Awake()
    {
        mImgProcess = transform.Find("bg/IMG_Process").GetComponent<Image>();
        mTextProcess = mImgProcess.transform.Find("TXT_Process").GetComponent<Text>();
    }

    public override void InitWindow()
    {
        base.InitWindow();
        ResetUIState();
    }

 

    public void SetProcess(int process, bool active)
    {
        SetWindowState(active);
        mImgProcess.fillAmount = process * 1.0f / 100f;
        mTextProcess.text = $"{process}%";
    }
    
    private void ResetUIState()
    {
        mImgProcess.fillAmount = 0;
        mTextProcess.text =$"0%";
    }
}
